<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoodsCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_categories', function (Blueprint $table) {
            $table->id();
            $table->integer('aid')->default(0)->comment('管理员ID');
            $table->integer('pid')->default(0)->comment('父级ID');
            $table->string('name', 32)->default('')->comment('名称');
            $table->tinyInteger('status')->default(0)->comment('状态');
            $table->tinyInteger('is_show')->default(0)->comment('是否大厅显示 1 显示 0 不显示');
            $table->tinyInteger('is_admin')->default(0)->comment('是否总后台添加 1 是 0 否');
            $table->timestamps();
            $table->index('aid');
            $table->index('pid');
            $table->index('is_show');
        });
        DB::statement("ALTER TABLE `goods_categories` comment '商品分类表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_categories');
    }
}
